package com.eight.clientcourse.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eight.common.pojo.EduCourse;
import com.eight.common.pojo.EduTeacher;
import com.eight.common.pojo.TbShoucangCourse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: qy8-education1
 * @description:
 * @author: 张亚祥
 * @create: 2023-06-06 14:20
 **/
public interface ShouCangCourseDao extends BaseMapper<TbShoucangCourse> {

    @Select(value = "select c.* from tb_shoucang_course sc join edu_course c on sc.course_id = c.id join tb_member m on sc.member_id = m.id ")
    List<EduCourse> addByTeacherStatus(QueryWrapper<EduCourse> wrapper);

    @Select(value = "select c.* from tb_shoucang_course st join edu_course c on st.course_id=c.id join tb_member m on st.member_id=m.id where c.id=#{courseId} and m.id=#{memberId}")
    EduCourse findFavoriteCourse(@Param("courseId") String courseId,@Param("memberId") String memberId);

}
